#!/bin/bash

# -----------------------------------------------------
# Start up all images
# -----------------------------------------------------
# First starts the main image (www) and ftp, then the rest.
# For each image waiting DELAY seconds before suspending it
# The whole process takes about DELAY * number of images 
# Server load should stay reasonable

# configuration
SERVICE_DIR=/service
DELAY=5

cd $SERVICE_DIR
svc -u www
svc -u ftp
ls | grep -v "^ftp$" | grep -v "\." | grep -v "^ADDITIONAL" | xargs -I {} sh -c "echo {} && svc -u {} && sleep $DELAY && svc -p {}"
